package com.atguigu.autowired.controller;

import com.atguigu.autowired.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
    // 根据类型找到对应的类
//    @Autowired
    private UserService userService;

    public UserController(UserService u) {
        this.userService = u;
    }

    // 根据类型找到对应的类
//    @Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }

    public void addUser() {
        userService.addUseService();
        System.out.println("controller执行了");
    }
}
